function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

function s(e) {
    d ? l < e && (l = e) && wx.setUserCloudStorage({
        KVDataList: [ {
            key: "score",
            value: l.toString()
        } ]
    }) : wx.getUserCloudStorage({
        keyList: [ "score" ],
        success: function(s) {
            for (var a = 0; a < s.KVDataList.length; a++) "score" === s.KVDataList[a].key && (l = parseInt(s.KVDataList[a].value)), 
            d = !0, clacBestScore(e);
        }
    });
}

var a = e(require("./friendRankList.js")), t = e(require("./groupRankList.js")), r = e(require("./endRankList.js")), c = e(require("./reviveRankList")), n = {
    FRIEND: 0,
    GROUP: 1,
    END: 2,
    REVIVE: 3
}, o = {
    PREVIOUS: 0,
    NEXT: 1
}, i = {
    RENDERList: 0,
    SWITCHPAGE: 1,
    CLOSEDRANK: 2,
    CALCBESTSCORE: 3,
    GETOPENID: 4,
    GETSCOREFONT: 5
}, E = "", l = 0, d = !1;

wx.getUserCloudStorage({
    keyList: [ "score" ],
    success: function(e) {
        for (var s = 0; s < e.KVDataList.length; s++) "score" === e.KVDataList[s].key && (l = parseInt(e.KVDataList[s].value));
        d = !0;
    }
});

var R = wx.getSharedCanvas().getContext("2d"), u = new a.default(R), k = new t.default(R), g = new r.default(R), C = new c.default(R);

wx.onMessage(function(e) {
    switch (console.log(e), e.mission) {
      case i.RENDERList:
        switch (e.renderType) {
          case n.FRIEND:
            u.logicHandle(e);
            break;

          case n.GROUP:
            k.logicHandle(e);
            break;

          case n.END:
            g.logicHandle(e);
            break;

          case n.REVIVE:
            C.logicHandle(e);
        }
        break;

      case i.SWITCHPAGE:
        switch (e.switchType) {
          case o.PREVIOUS:
            switch (e.renderType) {
              case n.FRIEND:
                u.previousPage();
                break;

              case n.GROUP:
                k.previousPage();
            }
            break;

          case o.NEXT:
            switch (e.renderType) {
              case n.FRIEND:
                u.nextPage(e);
                break;

              case n.GROUP:
                k.nextPage(e);
            }
        }
        break;

      case i.CLOSEDRANK:
        switch (e.renderType) {
          case n.FRIEND:
            u.closedClear();
            break;

          case n.GROUP:
            k.closedClear();
            break;

          case n.END:
            g.closedClear();
            break;

          case n.REVIVE:
            C.closedClear();
        }
        break;

      case i.CALCBESTSCORE:
        s(e.score);
        break;

      case i.GETOPENID:
        E = e.openId, u.setOpenId(E), k.setOpenId(E), g.setOpenId(E), C.setOpenId(E);
        break;

      case i.GETSCOREFONT:
        console.log(e), u.scoreFont = e.font, k.scoreFont = e.font, C.scoreFont = e.font, 
        g.scoreFont = e.font;
    }
});